
package com.xbongbong.paas.domain.dao;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.lang.Integer;

import com.xbongbong.paas.domain.entity.PaasProcessNodeTaskEntity;
import com.xbongbong.paas.domain.entity.ext.PaasProcessNodeTaskEntityExt;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;


/**
 * @author autoGen
 * @time 2018-08-13 10:43:26
 */
@Repository
@Mapper
public interface PaasProcessNodeTaskDao {


    Integer insert(PaasProcessNodeTaskEntity paasProcessTask);

    Integer update(PaasProcessNodeTaskEntity paasProcessTask);

    void insertBatch(@Param("list") List<PaasProcessNodeTaskEntity> paasProcessTaskList);

    Integer deleteByKey(@Param("key") Integer key, @Param("corpid") String corpid);

    PaasProcessNodeTaskEntity getByKey(@Param("key") Integer key, @Param("corpid") String corpid);


    List<PaasProcessNodeTaskEntityExt> findEntitys(@Param("param") Map<String, Object> param);

    Integer getEntitysCount(@Param("param") Map<String, Object> param);

    /**
     * 获取最新的那条我审批的数据
     *
     * @param map
     * @return PaasProcessNodeTaskEntityExt
     */
    PaasProcessNodeTaskEntityExt newProcessTask(@Param("param") Map<String, Object> map);

    /**
     * 获取提交打印和提交的总数
     *
     * @param map
     * @return
     */
    Integer getCommitOrCommitPrintCount(@Param("param") Map<String, Object> map);

    /**
     * 批量更新
     *
     * @param list
     * @param corpid
     */
    void updateBatch(@Param("list") List<PaasProcessNodeTaskEntity> list, @Param("corpid") String corpid);

    /**
     * 获取各个流程的最新节点
     *
     * @param param
     * @return
     */
    List<PaasProcessNodeTaskEntityExt> getLatestNodeForList(@Param("param") Map<String, Object> param);

    void deleteByTaskId(@Param("taskId") Long taskId, @Param("corpid") String corpid);

    void deleteBatch(@Param("list") List<PaasProcessNodeTaskEntityExt> taskIdList, @Param("corpid") String corpid);

    Integer getTaskCount(@Param("param") Map<String, Object> param);

    /**
     * 查询钉钉实例的任务
     * @param corpid
     * @param taskId
     * @return
     */
    List<String> getDingtalkProcessActivityId(@Param("corpid") String corpid, @Param("taskId") Integer taskId);

    /**
     * 特殊关联查询
     * @param param
     * @return
     */
    List<PaasProcessNodeTaskEntityExt> getJoinNodeForList(@Param("param") Map<String, Object> param);

    Integer getJoinNodeCount(@Param("param") Map<String, Object> param);

    /**
     * 根据表单id删除数据
     * @param formId
     * @param corpid
     * @return
     */
    Integer deleteByFormId(@Param("formId") Long formId, @Param("corpid") String corpid);

    /**
     * 审批抄送消息一键已读
     * @param param
     */
    void readAllCcList(@Param("param") HashMap<String, Object> param);

    List<PaasProcessNodeTaskEntityExt> getTaskCountLimit(@Param("param") Map<String, Object> param);
}